package sk.ygor.raynor.client.reflection;

import sk.ygor.raynor.client.json.JSONSerializer;

public interface JSONTypeInfo {

    public static class BaseType implements JSONTypeInfo {
        public final Nature nature;

        public BaseType(Nature nature) {
            this.nature = nature;
        }

        public static enum Nature {
            STRING, CHARACTER,
            LONG, INTEGER, SHORT, BYTE,
            FLOAT, DOUBLE,
            BOOLEAN
        }

    }

    public static class CollectionType implements JSONTypeInfo {
        public final Nature nature;
        public final String memberTypeRef;

        public CollectionType(Nature nature, String memberTypeRef) {
            this.nature = nature;
            this.memberTypeRef = memberTypeRef;
        }

        public static enum Nature {
            ARRAY, LIST, STRING_MAP
        }
    }

    public static class GenericType implements JSONTypeInfo {
        final JSONSerializer.ParametrizedClassName parametrizedClassName;
        final MaybeAttributes maybeAttributes;
        final String[] subTypeRefs;

        public GenericType(JSONSerializer.ParametrizedClassName parametrizedClassName, MaybeAttributes maybeAttributes, String[] subTypeRefs) {
            this.parametrizedClassName = parametrizedClassName;
            this.maybeAttributes = maybeAttributes;
            this.subTypeRefs = subTypeRefs;
        }

        public static class Attribute {
            public final String name;
            public final String typeRef;

            public Attribute(String name, String typeRef) {
                this.name = name;
                this.typeRef = typeRef;
            }
        }

        public static interface MaybeAttributes {

        }

        public static class HasAttributes implements MaybeAttributes {
            final Attribute[] attributes;

            public HasAttributes(Attribute[] attributes) {
                this.attributes = attributes;
            }
        }

        public static class NoAttributes implements MaybeAttributes {
            final String reason;

            public NoAttributes(String reason) {
                this.reason = reason;
            }
        }

        
    }


}
